/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package reamodel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import reamodel.DecrementCommitment;
import reamodel.DecrementEconomicEvent;
import reamodel.DecrementEconomicEventType;
import reamodel.IncrementEconomicEventType;
import reamodel.OutflowType;
import reamodel.ReamodelPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Decrement Economic Event Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link reamodel.impl.DecrementEconomicEventTypeImpl#getSpecify <em>Specify</em>}</li>
 *   <li>{@link reamodel.impl.DecrementEconomicEventTypeImpl#getTypify <em>Typify</em>}</li>
 *   <li>{@link reamodel.impl.DecrementEconomicEventTypeImpl#getOutflowType <em>Outflow Type</em>}</li>
 *   <li>{@link reamodel.impl.DecrementEconomicEventTypeImpl#getDualityType <em>Duality Type</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DecrementEconomicEventTypeImpl extends EconomicEventTypeImpl implements DecrementEconomicEventType {
	/**
	 * The cached value of the '{@link #getSpecify() <em>Specify</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSpecify()
	 * @generated
	 * @ordered
	 */
	protected EList<DecrementCommitment> specify;

	/**
	 * The cached value of the '{@link #getTypify() <em>Typify</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypify()
	 * @generated
	 * @ordered
	 */
	protected EList<DecrementEconomicEvent> typify;

	/**
	 * The cached value of the '{@link #getOutflowType() <em>Outflow Type</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOutflowType()
	 * @generated
	 * @ordered
	 */
	protected EList<OutflowType> outflowType;

	/**
	 * The cached value of the '{@link #getDualityType() <em>Duality Type</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDualityType()
	 * @generated
	 * @ordered
	 */
	protected EList<IncrementEconomicEventType> dualityType;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DecrementEconomicEventTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ReamodelPackage.Literals.DECREMENT_ECONOMIC_EVENT_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<DecrementCommitment> getSpecify() {
		if (specify == null) {
			specify = new EObjectResolvingEList<DecrementCommitment>(DecrementCommitment.class, this, ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__SPECIFY);
		}
		return specify;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<DecrementEconomicEvent> getTypify() {
		if (typify == null) {
			typify = new EObjectWithInverseResolvingEList<DecrementEconomicEvent>(DecrementEconomicEvent.class, this, ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY, ReamodelPackage.DECREMENT_ECONOMIC_EVENT__TYPIFIED_BY);
		}
		return typify;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<OutflowType> getOutflowType() {
		if (outflowType == null) {
			outflowType = new EObjectContainmentWithInverseEList<OutflowType>(OutflowType.class, this, ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE, ReamodelPackage.OUTFLOW_TYPE__EVENT_TYPE);
		}
		return outflowType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<IncrementEconomicEventType> getDualityType() {
		if (dualityType == null) {
			dualityType = new EObjectWithInverseResolvingEList.ManyInverse<IncrementEconomicEventType>(IncrementEconomicEventType.class, this, ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE, ReamodelPackage.INCREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE);
		}
		return dualityType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getTypify()).basicAdd(otherEnd, msgs);
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getOutflowType()).basicAdd(otherEnd, msgs);
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getDualityType()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				return ((InternalEList<?>)getTypify()).basicRemove(otherEnd, msgs);
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				return ((InternalEList<?>)getOutflowType()).basicRemove(otherEnd, msgs);
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				return ((InternalEList<?>)getDualityType()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__SPECIFY:
				return getSpecify();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				return getTypify();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				return getOutflowType();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				return getDualityType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__SPECIFY:
				getSpecify().clear();
				getSpecify().addAll((Collection<? extends DecrementCommitment>)newValue);
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				getTypify().clear();
				getTypify().addAll((Collection<? extends DecrementEconomicEvent>)newValue);
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				getOutflowType().clear();
				getOutflowType().addAll((Collection<? extends OutflowType>)newValue);
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				getDualityType().clear();
				getDualityType().addAll((Collection<? extends IncrementEconomicEventType>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__SPECIFY:
				getSpecify().clear();
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				getTypify().clear();
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				getOutflowType().clear();
				return;
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				getDualityType().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__SPECIFY:
				return specify != null && !specify.isEmpty();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__TYPIFY:
				return typify != null && !typify.isEmpty();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__OUTFLOW_TYPE:
				return outflowType != null && !outflowType.isEmpty();
			case ReamodelPackage.DECREMENT_ECONOMIC_EVENT_TYPE__DUALITY_TYPE:
				return dualityType != null && !dualityType.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //DecrementEconomicEventTypeImpl
